<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<html>
<head>
    <link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">
    <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
    <script src="http://libs.baidu.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
    <script type="text/javascript">
        $(function () {
            //按钮单击时执行
            $("#btn").click(function () {
                //Ajax调用处理
                $.ajax({
                    type: "GET",
                    contentType: "application/json",
                    url: "http://localhost:8090/test/log",
                    data: {},
                    success: function (data) {
                        alert(data.code);
                    }
                });

            });
        });
    </script>
</head>
<body>
<table>
    <tr>
        <td th:text="${action}">Red Chair</td>
    </tr>
</table>
<input id="btn" type="button" value="验证跨域请求"/>
<br/>
<table class="table table-hover table-condensed">
    <legend>
        <strong>用户列表</strong>
    </legend>
    <thead>
    <tr>
        <th>用户编号</th>
        <th>名称</th>
        <th>年龄</th>
        <th>出生时间</th>
        <th>管理</th>
    </tr>
    </thead>
    <tbody th:remove="all-but-first">
    <tr th:each="user : ${userList}">
        <th scope="row" th:text="${user.id}"></th>
        <td><a th:href="@{/edit/{userId}(userId=${user.id})}" th:text="${user.name}"></a></td>
        <td th:text="${user.age}"></td>
        <td th:text="${user.birthday}"></td>
        <td><a class="btn btn-danger" th:href="@{/edit/{userId}(userId=${user.id})}">编辑</a></td>
        <td><a class="btn btn-danger" th:href="@{/delete/{userId}(userId=${user.id})}">删除</a></td>
    </tr>
    <tr>
        <th scope="row">0013</th>
        <td>张三</td>
        <td>26</td>
        <td></td>
        <td><a class="btn btn-danger">编辑</a></td>
        <td><a class="btn btn-danger">删除</a></td>
    </tr>
    <tr>
        <th scope="row">0014</th>
        <td>张三2</td>
        <td>29</td>
        <td></td>
        <td><a class="btn btn-danger">编辑</a></td>
        <td><a class="btn btn-danger">删除</a></td>
    </tr>
    </tbody>
</table>
</body>
</html>